package com.ruoyi.student.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.student.domain.SchoolDegreeInfo;
import com.ruoyi.student.domain.StudentBaseInfo;
import com.ruoyi.student.domain.StudentRecommendInfo;
import com.ruoyi.student.domain.SysUserStudent;
import com.ruoyi.student.domain.vo.*;
import com.ruoyi.student.mapper.*;
import com.ruoyi.student.service.IStudentService;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


@Service
public class StudentServiceImpl implements IStudentService {

    @Resource
    private StudentMapper studentMapper;


    @Resource
    private StudentBaseInfoMapper studentBaseInfoMapper;


    @Resource
    private StudentRecommendInfoMapper studentRecommendInfoMapper;


    @Resource
    private SchoolDegreeInfoMapper schoolDegreeInfoMapper;


    @Resource
    private SysUserMapper sysUserMapper;

    @Resource
    private SysUserRoleMapper sysUserRoleMapper;


    @Resource
    private SysUserStudentMapper sysUserStudentMapper;


    @Resource
    private ISysConfigService sysConfigService;


    /**
     * 查询学生基础信息列表
     *
     * @param vo 查询条件
     * @return 学生基础信息集合
     */
    @Override
    public List<StudentListVo> selectStudentList(StudentListSearchVo vo) {
        return studentMapper.selectStudentList(vo);
    }


    /**
     * 获取学生推荐表信息列表
     *
     * @param vo
     * @return
     */
    @Override
    public List<StudentRecommendListVo> selectStudentRecommendList(StudentListSearchVo vo) {
        return studentMapper.selectStudentRecommendList(vo);
    }


    /**
     * 获取学生推荐表填写情况列表
     *
     * @param vo
     * @return
     */
    public List<StudentRecommendFillStateListVo> selectStudentRecommendFillStateList(StudentListSearchVo vo) {
        return studentMapper.selectStudentRecommendFillStateList(vo);
    }


    /**
     * 查询学生基础信息导出列表
     *
     * @param vo
     * @return
     */
    @Override
    public List<StudentExportListVo> selectStudentExportList(StudentListSearchVo vo) {
        return studentMapper.selectStudentExportList(vo);
    }


    /**
     * 获取年级、系别、专业聚合
     *
     * @return
     */
    @Override
    public List<SchoolDegreeInfo> selectAggrSchoolDegreeInfoList() {
        return schoolDegreeInfoMapper.selectAggrSchoolDegreeInfoList();
    }


    /**
     * 批量删除学生基础信息
     *
     * @param ids 需要删除的学生基础信息主键集合
     * @return 结果
     */
    @Override
    public int deleteStudentByIds(Long[] ids) {
        for (Long id : ids) {
            deleteStudentById(id);
        }
        return 1;
    }

    /**
     * 删除学生基础信息信息
     *
     * @param id 学生基础信息主键
     * @return 结果
     */
    @Override
    @Transactional
    public int deleteStudentById(Long id) {
        StudentBaseInfo studentBaseInfo = studentBaseInfoMapper.selectStudentBaseInfoById(id);
        if (ObjectUtil.isNotEmpty(studentBaseInfo)) {
            //删除基础数据
            studentBaseInfoMapper.deleteStudentBaseInfoById(id);
            //删除推荐表数据
            studentRecommendInfoMapper.deleteStudentRecommendInfoByCode(studentBaseInfo.getCode());
            SysUser sysUser = sysUserMapper.selectUserByUserName(studentBaseInfo.getCode());
            if (ObjectUtil.isNotEmpty(sysUser)) {
                sysUserRoleMapper.deleteUserRoleByUserId(sysUser.getUserId());
                sysUserMapper.deleteUserById(sysUser.getUserId());
            }
        }
        return 1;
    }


    /**
     * 添加单个学生（from 用户添加）
     *
     * @param vo
     * @return
     */
    @Override
    @Transactional
    public int addStudent(StudentAddVo vo) throws Exception {
        //操作时间戳
        Date opDate = DateUtils.getNowDate();

        StudentBaseInfo studentBaseInfo = new StudentBaseInfo();
        BeanUtils.copyProperties(vo, studentBaseInfo);
        if (StringUtils.isNotEmpty(studentBaseInfo.getIdNumber())) {
            studentBaseInfo.setIdNumber(AESUtils.AESEnCode(studentBaseInfo.getIdNumber()));
        }
        studentBaseInfo.setCreateTime(opDate);
        studentBaseInfo.setStudyState("待毕业生");

        StudentRecommendInfo studentRecommendInfo = new StudentRecommendInfo();
        studentRecommendInfo.setCode(vo.getCode());
        studentRecommendInfo.setCreateTime(opDate);
        studentRecommendInfo.setCreateBy(vo.getCreateBy());
        studentRecommendInfo.setStudentRecommendSubmit("1");//标记推荐表未提交
        studentRecommendInfo.setCounselorRecommendCheck("1");//标记推荐表未锁定
        studentRecommendInfoMapper.insert(studentRecommendInfo);

        //先判断下是已经存在SysUserStudent中，是否已经存在这个学生了，如果存在的话，先删除
        LambdaQueryWrapper<SysUserStudent> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(SysUserStudent::getUserName, vo.getCode());
        List<SysUserStudent> query = sysUserStudentMapper.selectList(lambdaQueryWrapper);
        if (!query.isEmpty()) {
            for (SysUserStudent sysUserStudent : query) {
                //先删除当前账号和角色的对应关系
                sysUserRoleMapper.deleteUserRoleByUserId(sysUserStudent.getUserId());
                //删除当前账号
                sysUserStudentMapper.deleteById(sysUserStudent.getUserId());
            }
        }
        //新增SysUserStudent
        SysUserStudent sysUserStudent = new SysUserStudent();
        sysUserStudent.setUserName(vo.getCode());
        sysUserStudent.setNickName(vo.getName());
        sysUserStudent.setUserType("ss");
        sysUserStudent.setStatus("0");
        sysUserStudent.setDelFlag("0");
        sysUserStudent.setPassword(SecurityUtils.encryptPassword(vo.getCode()));//用学生的账号来充当密码
        sysUserStudentMapper.insert(sysUserStudent);

        //绑定学生用户和角色的关系
        Long roleId = Long.parseLong(sysConfigService.selectConfigByKey("studentRoleId"));
        SysUserRole sysUserRole = new SysUserRole();
        sysUserRole.setRoleId(roleId);
        sysUserRole.setUserId(sysUserStudent.getUserId());
        sysUserRoleMapper.insert(sysUserRole);//将当前学生插入到sysUser表中
        return studentBaseInfoMapper.insert(studentBaseInfo);
    }


    /**
     * 添加单个学生（from 批量导入）
     *
     * @param vo
     * @return
     */
    public int addStudent(StudentBaseInfoTemplateVo vo) throws Exception {
        Date opDate = DateUtils.getNowDate();
        StudentBaseInfo studentBaseInfo = OrikaUtils.convert(vo, StudentBaseInfo.class);
        if (StringUtils.isNotEmpty(studentBaseInfo.getIdNumber())) {
            //如果当前身份证号不为空，那么加密当前的身份证号
            studentBaseInfo.setIdNumber(AESUtils.AESEnCode(studentBaseInfo.getIdNumber()));
        }
        studentBaseInfo.setGraduateTime(new Date(Integer.parseInt(studentBaseInfo.getGraduationYear()), 7, 1));//设定毕业年份
        studentBaseInfo.setCreateTime(opDate);
        studentBaseInfo.setStudyState("待毕业生");
        StudentRecommendInfo studentRecommendInfo = new StudentRecommendInfo();
        studentRecommendInfo.setCode(vo.getCode());
        studentRecommendInfo.setCreateTime(opDate);
        studentRecommendInfo.setCreateBy(vo.getCreateBy());
        studentRecommendInfo.setStudentRecommendSubmit("1");//标记推荐表未提交
        studentRecommendInfo.setCounselorRecommendCheck("1");//标记推荐表未锁定
        studentRecommendInfoMapper.insert(studentRecommendInfo);

        SysUserStudent sysUserStudent = new SysUserStudent();
        sysUserStudent.setUserName(vo.getCode());
        sysUserStudent.setNickName(vo.getName());
        sysUserStudent.setUserType("ss");
        sysUserStudent.setStatus("0");
        sysUserStudent.setDelFlag("0");
        sysUserStudent.setPassword(SecurityUtils.encryptPassword(vo.getCode()));//用学生的账号来充当密码
        sysUserStudentMapper.insert(sysUserStudent);

        //绑定学生用户和角色的关系
        Long roleId = Long.parseLong(sysConfigService.selectConfigByKey("studentRoleId"));
        SysUserRole sysUserRole = new SysUserRole();
        sysUserRole.setRoleId(roleId);
        sysUserRole.setUserId(sysUserStudent.getUserId());
        sysUserRoleMapper.insert(sysUserRole);

        return studentBaseInfoMapper.insert(studentBaseInfo);
    }


    /**
     * 编辑单个学生
     *
     * @param vo
     * @return
     */
    public int editStudent(StudentEditVo vo) throws Exception {
        LambdaUpdateWrapper<StudentBaseInfo> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        lambdaUpdateWrapper.eq(StudentBaseInfo::getId, vo.getId());
        lambdaUpdateWrapper.set(StudentBaseInfo::getName, vo.getName());
        lambdaUpdateWrapper.set(StudentBaseInfo::getCode, vo.getCode());
        lambdaUpdateWrapper.set(StudentBaseInfo::getExamineeNumber, vo.getExamineeNumber());
        lambdaUpdateWrapper.set(StudentBaseInfo::getSex, vo.getSex());
        lambdaUpdateWrapper.set(StudentBaseInfo::getBirthday, vo.getBirthday());
        lambdaUpdateWrapper.set(StudentBaseInfo::getEnterTime, vo.getEnterTime());
        lambdaUpdateWrapper.set(StudentBaseInfo::getGraduationYear, vo.getGraduationYear());
        lambdaUpdateWrapper.set(StudentBaseInfo::getCampus, vo.getCampus());
        lambdaUpdateWrapper.set(StudentBaseInfo::getOrganization, vo.getOrganization());
        lambdaUpdateWrapper.set(StudentBaseInfo::getGrade, vo.getGrade());
        lambdaUpdateWrapper.set(StudentBaseInfo::getDepartment, vo.getDepartment());
        lambdaUpdateWrapper.set(StudentBaseInfo::getMajor, vo.getMajor());
        lambdaUpdateWrapper.set(StudentBaseInfo::getMajorDirection, vo.getMajorDirection());
        lambdaUpdateWrapper.set(StudentBaseInfo::getStudyTime, vo.getStudyTime());
        lambdaUpdateWrapper.set(StudentBaseInfo::getClassNum, vo.getClassNum());
        lambdaUpdateWrapper.set(StudentBaseInfo::getCounsellorCode, vo.getCounsellorCode());
        lambdaUpdateWrapper.set(StudentBaseInfo::getNation, vo.getNation());
        lambdaUpdateWrapper.set(StudentBaseInfo::getSource, vo.getSource());
        lambdaUpdateWrapper.set(StudentBaseInfo::getPoliticalStatus, vo.getPoliticalStatus());
        //如果当前身份证号不为空，那么加密当前的身份证号
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getIdNumber()), StudentBaseInfo::getIdNumber, AESUtils.AESEnCode(vo.getIdNumber()));
        lambdaUpdateWrapper.set(StudentBaseInfo::getDifficulty, vo.getDifficulty());
        lambdaUpdateWrapper.set(StudentBaseInfo::getUpdateBy, vo.getUpdateBy());
        lambdaUpdateWrapper.set(StudentBaseInfo::getUpdateTime, DateUtils.getNowDate());
        return studentBaseInfoMapper.update(null, lambdaUpdateWrapper);
    }


    /**
     * 编辑单个学生
     *
     * @param vo
     * @return
     */
    public int editStudentByImport(String code, StudentBaseInfoTemplateVo vo) {
        LambdaUpdateWrapper<StudentBaseInfo> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        lambdaUpdateWrapper.eq(StudentBaseInfo::getCode, code);
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getExamineeNumber()), StudentBaseInfo::getExamineeNumber, vo.getExamineeNumber());
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getName()), StudentBaseInfo::getName, vo.getName());
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getSex()), StudentBaseInfo::getSex, vo.getSex());
        lambdaUpdateWrapper.set(vo.getBirthday() != null, StudentBaseInfo::getBirthday, vo.getBirthday());
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getPoliticalStatus()), StudentBaseInfo::getPoliticalStatus, vo.getPoliticalStatus());
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getNation()), StudentBaseInfo::getNation, vo.getNation());//更新民族
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getSource()), StudentBaseInfo::getSource, vo.getSource());//更新生源地
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getIdNumber()), StudentBaseInfo::getIdNumber, vo.getIdNumber());//更新身份证号
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getCampus()), StudentBaseInfo::getCampus, vo.getCampus());//更新校区
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getOrganization()), StudentBaseInfo::getOrganization, vo.getOrganization());//更新总支
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getGrade()), StudentBaseInfo::getGrade, vo.getGrade());//更新年级
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getDepartment()), StudentBaseInfo::getDepartment, vo.getDepartment());//更新院系
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getMajor()), StudentBaseInfo::getMajor, vo.getMajor());//更新专业
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getMajorDirection()), StudentBaseInfo::getMajorDirection, vo.getMajorDirection());//更新专业方向
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getStudyTime()), StudentBaseInfo::getStudyTime, vo.getStudyTime());//更新学制
        lambdaUpdateWrapper.set(vo.getClassNum() != null && vo.getClassNum() != 0, StudentBaseInfo::getClassNum, vo.getClassNum());//更新班号
        lambdaUpdateWrapper.set(vo.getEnterTime() != null, StudentBaseInfo::getEnterTime, vo.getEnterTime());//更新入学时间
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getGraduationYear()), StudentBaseInfo::getGraduationYear, vo.getGraduationYear());//更新毕业年份
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getDifficulty()), StudentBaseInfo::getDifficulty, vo.getDifficulty());//更新困难情况
        lambdaUpdateWrapper.set(StringUtils.isNotEmpty(vo.getCounsellorCode()), StudentBaseInfo::getCounsellorCode, vo.getCounsellorCode());//更新辅导员工号
        return studentBaseInfoMapper.update(null, lambdaUpdateWrapper);
    }


    /**
     * 编辑学生推荐表基础信息
     *
     * @return
     */
    @Override
    @Transactional
    public int editStudentRecommendBaseInfo(EditStudentBaseInfoVo vo) {
        LambdaUpdateWrapper<StudentBaseInfo> studentBaseInfoLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        studentBaseInfoLambdaUpdateWrapper.eq(StudentBaseInfo::getCode, vo.getCode());
        studentBaseInfoLambdaUpdateWrapper.set(StudentBaseInfo::getPhoneNumber, vo.getPhoneNumber());
        LambdaUpdateWrapper<StudentRecommendInfo> studentRecommendInfoLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        studentRecommendInfoLambdaUpdateWrapper.eq(StudentRecommendInfo::getCode, vo.getCode());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getEmail, vo.getEmail());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getQq, vo.getQq());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getHomeAddress, vo.getHomeAddress());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getHomeCode, vo.getHomeCode());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getHomePhone, vo.getHomePhone());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getIsHkInSchool, vo.getIsHkInSchool());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getIsCityStudent, vo.getIsCityStudent());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getRxqhkszdpcs, vo.getRxqhkszdpcs());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getRxqdaszdw, vo.getRxqdaszdw());
        studentRecommendInfoMapper.update(null, studentRecommendInfoLambdaUpdateWrapper);
        return studentBaseInfoMapper.update(null, studentBaseInfoLambdaUpdateWrapper);
    }


    /**
     * 编辑学生推荐表推进信息
     *
     * @return
     */
    @Override
    @Transactional
    public int editStudentRecommendRecommendInfo(EditStudentRecommendInfoVo vo) {
        LambdaUpdateWrapper<StudentBaseInfo> studentBaseInfoLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        studentBaseInfoLambdaUpdateWrapper.eq(StudentBaseInfo::getCode, vo.getCode());
        LambdaUpdateWrapper<StudentRecommendInfo> studentRecommendInfoLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        studentRecommendInfoLambdaUpdateWrapper.eq(StudentRecommendInfo::getCode, vo.getCode());

        studentBaseInfoLambdaUpdateWrapper.set(StudentBaseInfo::getPoliticalStatus, vo.getPoliticalStatus());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getForeignLanguageEvel, vo.getForeignLanguageEvel());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getComputerLevel, vo.getComputerLevel());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getJobIntention, vo.getJobIntention());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getQualification, vo.getQualification());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getDepartmentOpinion, vo.getDepartmentOpinion());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getRewardPunishmentPrize1, vo.getRewardPunishmentPrize1());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getRewardPunishmentPrize2, vo.getRewardPunishmentPrize2());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getRewardPunishmentPrize3, vo.getRewardPunishmentPrize3());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getRewardPunishmentPrize4, vo.getRewardPunishmentPrize4());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getRewardPunishmentPrize5, vo.getRewardPunishmentPrize5());

        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getWorkContent1, vo.getWorkContent1());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getWorkContent2, vo.getWorkContent2());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getWorkContent3, vo.getWorkContent3());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getWorkContent4, vo.getWorkContent4());
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getWorkContent5, vo.getWorkContent5());

        studentRecommendInfoMapper.update(null, studentRecommendInfoLambdaUpdateWrapper);
        return studentBaseInfoMapper.update(null, studentBaseInfoLambdaUpdateWrapper);
    }


    /**
     * 查询学生推荐表确认信息
     *
     * @param code
     * @return
     */
    @Override
    public SelectStudentRecommendCheckInfoVo selectStudentRecommendCheckInfo(String code) {
        LambdaUpdateWrapper<StudentBaseInfo> studentBaseInfoLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        studentBaseInfoLambdaUpdateWrapper.eq(StudentBaseInfo::getCode, code);
        LambdaUpdateWrapper<StudentRecommendInfo> studentRecommendInfoLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        studentRecommendInfoLambdaUpdateWrapper.eq(StudentRecommendInfo::getCode, code);
        StudentBaseInfo studentBaseInfo = studentBaseInfoMapper.selectOne(studentBaseInfoLambdaUpdateWrapper);
        StudentRecommendInfo studentRecommendInfo = studentRecommendInfoMapper.selectOne(studentRecommendInfoLambdaUpdateWrapper);
        SelectStudentRecommendCheckInfoVo vo = new SelectStudentRecommendCheckInfoVo();
        BeanUtils.copyProperties(studentBaseInfo, vo);
        BeanUtils.copyProperties(studentRecommendInfo, vo);
        return vo;
    }


    /**
     * 确认学生推荐表的信息
     *
     * @param code
     * @return
     */
    @Override
    public int confirmInfo(String code) {
        LambdaUpdateWrapper<StudentRecommendInfo> studentRecommendInfoLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        studentRecommendInfoLambdaUpdateWrapper.eq(StudentRecommendInfo::getCode, code);
        studentRecommendInfoLambdaUpdateWrapper.set(StudentRecommendInfo::getStudentRecommendSubmit, "0");
        return studentRecommendInfoMapper.update(null, studentRecommendInfoLambdaUpdateWrapper);
    }


    /**
     * 获取指定毕业年份的毕业生人数
     *
     * @param year
     * @return
     */
    @Override
    public Long selectGraduationStudentCount(String year) {
        LambdaQueryWrapper<StudentBaseInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(StudentBaseInfo::getGraduationYear, year);
        return studentBaseInfoMapper.selectCount(lambdaQueryWrapper);
    }


    /**
     * 查询学生推荐表信息列表
     *
     * @param vo
     * @return
     */
    @Override
    public List<SelectStudentRecommendInfoVo> selectStudentRecommendInfoList(StudentRecommendInfoListSearchVo vo) {
        return studentMapper.selectStudentRecommendInfoList(vo);
    }

    /**
     * 查询学生核对单列表
     *
     * @param vo
     * @return
     */
    @Override
    public List<SelectCheckTableListVo> selectCheckTableList(SelectCheckTableSearchVo vo) {
        List<SelectCheckTableListVo> selectCheckTableList = studentMapper.selectCheckTableList(vo);
        for (SelectCheckTableListVo item : selectCheckTableList) {
            if (StringUtils.isNotEmpty(item.getIdNumber())) {
                try {
                    item.setIdNumber(AESUtils.AESDeCode(item.getIdNumber()));
                } catch (Exception e) {
                    item.setIdNumber("身份证号解析失败");
                }
            }
        }
        return selectCheckTableList;
    }

    /**
     * 设定学生带兵方案
     *
     * @param vo
     * @return
     */
    @Override
    public int setStudentLead(SetStudentLeadVo vo) {
        return studentMapper.setStudentLead(vo);
    }


}
